import { useTranslation } from 'react-i18next';
import { Helmet } from 'react-helmet-async';
import { motion } from 'framer-motion';
import { Header } from '@/components/Header';
import { Footer } from '@/components/Footer';
import { useSEOConfig, generateHreflangTags, generateStructuredData } from '@/lib/seo';

export default function VerticalIndustry() {
  const { t } = useTranslation();
  const seoConfig = useSEOConfig({
    title: `${t('header.verticalIndustries')} - 豆豆Pay`,
    description: t('seo.pages.verticalIndustry.description')
  });
  const hreflangTags = generateHreflangTags('/solutions/vertical-industry');
  const structuredData = generateStructuredData(seoConfig, 'website');

  // 行业解决方案数据
  const industries = [
    {
      title: t('verticalIndustry.retail'),
      description: t('verticalIndustry.retailDesc'),
      icon: 'fa-shopping-bag',
      imageUrl: 'https://space.coze.cn/api/coze_space/gen_image?image_size=landscape_16_9&prompt=retail%20industry%20payment%20solution%2C%20modern%20department%20store%2C%20customers%20shopping&sign=392b926bf936757e6f848af1ec76bf43'
    },
    {
      title: t('verticalIndustry.banking'),
      description: t('verticalIndustry.bankingDesc'),
      icon: 'fa-university',
      imageUrl: 'https://space.coze.cn/api/coze_space/gen_image?image_size=landscape_16_9&prompt=banking%20industry%20solution%2C%20modern%20bank%20interior%2C%20financial%20services&sign=53aff27fbcd0f690e03e87e655ceae65'
    },
    {
      title: t('verticalIndustry.catering'),
      description: t('verticalIndustry.cateringDesc'),
      icon: 'fa-utensils',
      imageUrl: 'https://space.coze.cn/api/coze_space/gen_image?image_size=landscape_16_9&prompt=catering%20industry%20solution%2C%20modern%20restaurant%2C%20customers%20dining&sign=c348b53c433319142312f67b18c068f3'
    },
    {
      title: t('verticalIndustry.hotel'),
      description: t('verticalIndustry.hotelDesc'),
      icon: 'fa-hotel',
      imageUrl: 'https://space.coze.cn/api/coze_space/gen_image?image_size=landscape_16_9&prompt=hotel%20industry%20solution%2C%20luxury%20hotel%20lobby%2C%20reception%20area&sign=58cc303dfd0864bd9460ba759ddd5f82'
    }
  ];

  // 解决方案优势
  const advantages = [
    {
      title: t('verticalIndustry.advantage1Title'),
      description: t('verticalIndustry.advantage1Desc'),
      icon: 'fa-cubes'
    },
    {
      title: t('verticalIndustry.advantage2Title'),
      description: t('verticalIndustry.advantage2Desc'),
      icon: 'fa-bolt'
    },
    {
      title: t('verticalIndustry.advantage3Title'),
      description: t('verticalIndustry.advantage3Desc'),
      icon: 'fa-shield-alt'
    },
    {
      title: t('verticalIndustry.advantage4Title'),
      description: t('verticalIndustry.advantage4Desc'),
      icon: 'fa-chart-line'
    }
  ];

  return (
    <div className="min-h-screen flex flex-col bg-white">
      <Helmet>
        {/* Basic Meta Tags */}
        <title>{seoConfig.title}</title>
        <meta name="description" content={seoConfig.description} />
        <meta name="keywords" content={seoConfig.keywords} />

        {/* Canonical URL */}
        <link rel="canonical" href={seoConfig.url} />

        {/* Open Graph / Facebook */}
        <meta property="og:title" content={seoConfig.title} />
        <meta property="og:description" content={seoConfig.description} />
        <meta property="og:image" content={seoConfig.image} />
        <meta property="og:url" content={seoConfig.url} />
        <meta property="og:locale" content={seoConfig.locale} />
        <meta property="og:site_name" content={seoConfig.siteName} />
        <meta property="og:type" content="website" />

        {/* Twitter */}
        <meta name="twitter:title" content={seoConfig.title} />
        <meta name="twitter:description" content={seoConfig.description} />
        <meta name="twitter:image" content={seoConfig.image} />
        <meta name="twitter:card" content="summary_large_image" />

        {/* Hreflang tags for multilingual SEO */}
        {hreflangTags.map((tag, index) => (
          <link key={index} rel={tag.rel} hrefLang={tag.hreflang} href={tag.href} />
        ))}

        {/* Structured Data */}
        <script type="application/ld+json">
          {JSON.stringify(structuredData)}
        </script>
      </Helmet>
      
      <Header />
      
      <main className="flex-grow">
        {/* 页面标题区域 */}
        <section className="py-16 md:py-24 bg-gradient-to-r from-indigo-50 to-purple-50">
          <div className="container mx-auto px-4">
            <motion.div
              initial={{ opacity: 0, y: 20 }}
              animate={{ opacity: 1, y: 0 }}
              transition={{ duration: 0.8 }}
              className="max-w-3xl mx-auto text-center"
            >
              <h1 className="text-3xl md:text-5xl font-bold text-gray-900 mb-6">
                {t('header.verticalIndustries')}
              </h1>
              <div className="w-20 h-1 bg-indigo-500 mx-auto mb-8 rounded-full"></div>
              <p className="text-lg md:text-xl text-gray-700 leading-relaxed">
                {t('verticalIndustry.intro')}
              </p> 
            </motion.div>
          </div>
        </section>
        
        {/* 行业解决方案 */}
        <section className="py-20 bg-white">
          <div className="container mx-auto px-4">
            <div className="text-center max-w-3xl mx-auto mb-16">
              <h2 className="text-3xl md:text-4xl font-bold text-gray-900 mb-4">
                {t('verticalIndustry.industrySolutionsTitle')}
              </h2>
              <div className="w-20 h-1 bg-indigo-500 mx-auto mb-8 rounded-full"></div>
              <p className="text-gray-700">
                {t('verticalIndustry.industrySolutionsDesc')}
              </p>
            </div>
            
            <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-8">
              {industries.map((industry, index) => (
                <motion.div
                  key={index}
                  initial={{ opacity: 0, y: 30 }}
                  whileInView={{ opacity: 1, y: 0 }}
                  transition={{ duration: 0.5, delay: index * 0.1 }}
                  viewport={{ once: true }}
                  className="group bg-white rounded-xl overflow-hidden shadow-lg hover:shadow-xl transition-all duration-300"
                >
                  <div className="h-48 overflow-hidden">
                    <img 
                      src={industry.imageUrl} 
                      alt={industry.title} 
                      className="w-full h-full object-cover transition-transform duration-700 group-hover:scale-110"
                    />
                  </div>
                  <div className="p-6">
                    <div className="w-12 h-12 rounded-full bg-indigo-100 flex items-center justify-center text-indigo-600 mb-4">
                      <i className={`fa-solid ${industry.icon} text-xl`}></i>
                    </div>
                    <h3 className="text-xl font-bold text-gray-900 mb-3 group-hover:text-indigo-600 transition-colors">
                      {industry.title}
                    </h3>
                    <p className="text-gray-600 mb-6">
                      {industry.description}
                    </p>
                    <a 
                      href={index === 0 ? "/solutions/retail-store" : index === 1 ? "/solutions/small-bank" : "#"} 
                      className="inline-flex items-center text-indigo-600 font-medium hover:text-indigo-800 transition-colors"
                    >
                      {t('about.learnMore')}
                      <i className="fa-solid fa-arrow-right ml-2 text-sm"></i>
                    </a>
                  </div>
                </motion.div>
              ))}
            </div>
          </div>
        </section>
        
        {/* 解决方案优势 */}
        <section className="py-20 bg-gray-50">
          <div className="container mx-auto px-4">
            <div className="grid grid-cols-1 lg:grid-cols-2 gap-16 items-center">
              <motion.div
                initial={{ opacity: 0, x: -30 }}
                whileInView={{ opacity: 1, x: 0 }}
                transition={{ duration: 0.8 }}
                viewport={{ once: true }}
              >
                <h2 className="text-2xl md:text-3xl font-bold text-gray-900 mb-6">
                  {t('verticalIndustry.advantagesTitle')}
                </h2>
                <div className="w-16 h-1 bg-indigo-500 mb-8 rounded-full"></div>
                
                <div className="space-y-6">
                  {advantages.map((advantage, index) => (
                    <div key={index} className="flex">
                      <div className="mr-4 text-indigo-500 mt-1">
                        <i className={`fa-solid ${advantage.icon} text-xl`}></i>
                      </div>
                      <div>
                        <h3 className="text-xl font-bold text-gray-900 mb-2">
                          {advantage.title}
                        </h3>
                        <p className="text-gray-600">
                          {advantage.description}
                        </p>
                      </div>
                    </div>
                  ))}
                </div>
              </motion.div>
              
              <motion.div
                initial={{ opacity: 0, x: 30 }}
                whileInView={{ opacity: 1, x: 0 }}
                transition={{ duration: 0.8, delay: 0.3 }}
                viewport={{ once: true }}
                className="relative"
              >
                <div className="rounded-xl overflow-hidden shadow-2xl">
                  <img 
                    src="https://space.coze.cn/api/coze_space/gen_image?image_size=landscape_16_9&prompt=industry-specific%20payment%20solutions%2C%20business%20integration%2C%20digital%20transformation&sign=81135c7d86434cb74f38cb36541b2b6f" 
                    alt={t('verticalIndustry.advantagesTitle')} 
                    className="w-full h-auto"
                  />
                </div>
                <div className="absolute -bottom-6 -right-6 w-40 h-40 bg-indigo-100 rounded-full -z-10"></div>
                <div className="absolute -top-6 -left-6 w-24 h-24 bg-purple-100 rounded-full -z-10"></div>
              </motion.div>
            </div>
          </div>
        </section>
        
        {/* 联系咨询 */}
        <section className="py-20 bg-indigo-600 text-white">
          <div className="container mx-auto px-4 text-center">
            <motion.div
              initial={{ opacity: 0, y: 30 }}
              whileInView={{ opacity: 1, y: 0 }}
              transition={{ duration: 0.8 }}
              viewport={{ once: true }}
            >
              <h2 className="text-3xl md:text-4xl font-bold mb-6">
                {t('verticalIndustry.ctaTitle')}
              </h2>
              <p className="text-xl text-indigo-100 max-w-2xl mx-auto mb-10">
                {t('verticalIndustry.ctaDesc')}
              </p>
              <div className="flex flex-col sm:flex-row justify-center gap-4">
                <a 
                  href="/contact" 
                  className="px-8 py-4 bg-white text-indigo-600 font-medium rounded-md hover:bg-indigo-50 transition-colors shadow-lg"
                >
                  {t('verticalIndustry.contactBtn')}
                </a>
                <a 
                  href="#" 
                  className="px-8 py-4 bg-transparent border-2 border-white text-white font-medium rounded-md hover:bg-indigo-700 transition-colors"
                >
                  {t('verticalIndustry.consultBtn')}
                </a>
              </div>
            </motion.div>
          </div>
        </section>
      </main>
      
      <Footer />
    </div>
  );
}